package com.tianji.learning.controller.admin;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domian.DTO.QuestionFormDTO;
import com.tianji.learning.domian.query.QuestionAdminPageQuery;
import com.tianji.learning.domian.query.QuestionPageQuery;
import com.tianji.learning.domian.vo.QuestionAdminVO;
import com.tianji.learning.domian.vo.QuestionVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-03-21
 */
@Slf4j
@RestController
@RequestMapping("/admin/questions")
@Api(tags = "管理端互动问题相关接口")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService questionService;

    @GetMapping("/page")
    @ApiOperation("分页查询互动问题")
    public PageDTO<QuestionAdminVO> queryQuestionPage(QuestionAdminPageQuery pageQuery) {
        return questionService.queryQuestionPageAdmin(pageQuery);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据id查询互动问题")
    public QuestionAdminVO queryQuestionById(@PathVariable("id") Long id) {
        return questionService.queryQuestionByIdAdmin(id);
    }

    /**
     * 隐藏或显示问题
     */

    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("隐藏或显示问题")
    public void hiddenQuestion(
            @ApiParam(value = "问题id", example = "1") @PathVariable("id") Long id,
            @ApiParam(value = "是否隐藏，true/false", example = "true") @PathVariable("hidden") Boolean hidden) {
        questionService.hiddenQuestion(id, hidden);
    }

}
